import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '名称',
    dataIndex: 'name',
    align: 'left',
  },
  {
    title: '数据库',
    dataIndex: 'database',
    align: 'center',
  },
  {
    title: '类型',
    dataIndex: 'type',
    align: 'center',
  },
  {
    title: 'IP',
    dataIndex: 'ip',
    align: 'left',
  },
  {
    title: '端口',
    dataIndex: 'port',
    align: 'center',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'name',
    label: '名称',
    component: 'Input',
    colProps: { span: 5 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'name',
    label: '名称',
    component: 'Input',
    colProps: {
      span: 24,
    },
  },
  {
    field: 'oadb',
    label: '数据库类型',
    component: 'Select',
    componentProps: {
      options: [
        {
          value: 'mysql',
          label: 'MySQL',
        },
        {
          value: 'mssql',
          label: 'SQLServer2000/2003',
        },
        {
          value: 'mssql_n',
          label: 'SQLServer2005+',
        },
        {
          value: 'oracle',
          label: 'Oracle',
        },
        {
          value: 'postgresql',
          label: 'PostGreSql',
        },
      ],
      getPopupContainer: () => document.body,
    },
    colProps: {
      span: 24,
    },
  },
  {
    field: 'odbcName',
    label: 'ODBC驱动程序',
    component: 'Input',
    ifShow: false,
    colProps: {
      span: 24,
    },
  },
  {
    field: 'ip',
    label: 'IP',
    component: 'Input',
    colProps: {
      span: 24,
    },
  },
  {
    field: 'port',
    label: '端口号',
    component: 'Input',
    colProps: {
      span: 24,
    },
  },
  {
    field: 'database',
    label: '数据库名',
    component: 'Input',
    colProps: {
      span: 24,
    },
  },
  {
    field: 'maxConn',
    label: '最大连接数',
    component: 'Input',
    colProps: {
      span: 24,
    },
  },
  {
    field: 'user',
    label: '用户名',
    required: true,
    component: 'Input',
    colProps: {
      span: 24,
    },
  },
  {
    field: 'pwd',
    label: '密码',
    required: true,
    component: 'InputPassword',
    colProps: {
      span: 24,
    },
  },
];
